package Level03_four_important;

import java.util.ArrayList;

public class Size {
    //传入一个玩家数组，将其中的两个元素相加
    public int size(ArrayList<String> player) {
        int sum = 0;
        for (String s : player) {
            s = s.substring(1);
            if (s.contains("A")) {
                sum += 1;
            } else if (s.contains("10")) {
                sum += 10;
            } else if (s.contains("J")) {
                sum += 11;
            } else if (s.contains("Q")) {
                sum += 12;
            } else if (s.contains("K")) {
                sum += 13;
            } else {
                sum += Integer.parseInt(s);
            }
        }
        return sum;
    }
}
